# -*- coding: utf-8 -*-
import time
import datetime

__author__ = 'nibo'
str_time = '2015-09-30'
fmt = '%Y-%m-%d'
fmt2 = '%Y-%m-%d %H:%M:%S'

# print time.strptime(str_time, fmt)

# print time.time()

# print time.localtime()

d = datetime.datetime.strptime(str_time, fmt)
print u'字符串转换为日期格式：'
print d
one = d + datetime.timedelta(days=1)
print u'第1次：%s' % one

two = one + datetime.timedelta(days=2)
print u'第2次：%s' % two

three = two + datetime.timedelta(days=4)
print u'第3次：%s' % three

four = three + datetime.timedelta(days=7)
print u'第4次：%s' % four

five = four + datetime.timedelta(days=15)
print u'第5次：%s' % five

print u'将日期转换为字符串：'
print d.strftime(fmt)

print u'当前时间:%s' % datetime.datetime.now()
new_datetime = str_time + ' ' + datetime.datetime.now().strftime('%H:%M:%S')
print u'转换后的字符串：%s' % new_datetime
print u'新的日期：%s' % \
      (datetime.datetime.strptime(new_datetime, fmt2) + datetime.timedelta(days=3))
